<%@ page import="com.webamc.common.enums.Fields" %>
<%@ page import="com.webamc.common.enums.Params" %>
<%@ page import="com.webamc.model.AMCOrder" %>
<%@ page import="com.webamc.util.CommonUtil" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<link rel="stylesheet" href="../webamc.css"/>
<div class="action-header">AMC Orders</div>
<%
    List<AMCOrder> list = (List) request.getAttribute(Params.BEAN);
    if (list == null || list.size() == 0) {
%><p class="header-divsmall">No AMC Orders, <a href="amcorder.html?action=beforeCreate">click here</a> to create.</p>
<%
        return;
    }
%>
<jsp:include page="msgs.jsp"/>

<table class="browse-table" border="1">
    <thead>
        <tr>
            <th>OrderId</th>
            <th>Customer</th>
            <th>Product Id</th>
            <th>Product Serial</th>
            <th>Scheduling</th>
            <th>Status</th>
            <th>Create Date</th>
            <th>Start Date</th>
            <th>Duration</th>
            <th>Description</th>
            <th>Remarks</th>
            <th>Version</th>
            <th>LastUpdated</th>
        </tr>
    </thead>
    <tbody>
        <%
            boolean even = true;
            for (AMCOrder order : list) {
                even = !even;
        %>
        <tr class="<%=even?"rowone":"rowtwo"%>">

            <td>
                <a href="amcorder.html?action=view&<%=Fields.ORDERID%>=<%=order.getOrderId()%>">
                    <%=order.getOrderId()%>
                </a>
            </td>
            <td>
                <a href="amcorder.html?action=view&<%=Fields.PARENTORDERID%>=<%=order.getParentOrderId()%>">
                    <%=order.getParentOrderId()%>
                </a>
            </td>
                <a href="customer.html?action=view&<%=Fields.CUSTOMERID%>=<%=order.getCustomerId()%>">
                    <%=order.getCustomerId()%>
                </a>
            </td>
            <td>
                <a href="product.html?action=view&<%=Fields.PRODUCTID%>=<%=order.getProductName()%>">
                    <%=order.getProductName()%>
                </a>
            </td>
            <td><%=CommonUtil.out(order.getProductSerial())%>
            </td>
            <td><%=CommonUtil.out(order.getAmcSchedule())%>
            </td>
            <td><%=CommonUtil.out(order.getStatus())%>
            </td>
            <td><%=CommonUtil.getDateString(order.getCreateDate())%>
            </td>
            <td><%=CommonUtil.getDateString(order.getStartTime())%>
            </td>
            <td><%=order.getTermLength()%></td>
            <td><%=CommonUtil.out(order.getDescription())%>
            </td>
            <td><%=CommonUtil.out(order.getRemarks())%>
            </td>
            <td><%=order.getVersion()%>
            </td>
            <td><%=CommonUtil.getDateString(order.getLastUpdated())%>
            </td>
        </tr>
        <%}%>
    </tbody>
</table>
